﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Routing;

namespace RMS
{
    /* URL Routing Class -- for improving website navigation */

    public class RouteConfig
    {
        
        public static void RegisterRoutes(RouteCollection routes)
        {
            // The order in which routes are defined can matter.
            // The {page} part is known as a routing segment variable
            routes.MapPageRoute(null, "list/{category}/{page}", "~/Pages/Listing.aspx");
            routes.MapPageRoute(null, "list/{page}", "~/Pages/Listing.aspx"); // Example-http://localhost:53506/list/2 
            routes.MapPageRoute(null, "", "~/Pages/Listing.aspx");
            routes.MapPageRoute(null, "list", "~/Pages/Listing.aspx");
            routes.MapPageRoute(null, "home", "~/Pages/Home.aspx");
            routes.MapPageRoute("cart", "cart", "~/Pages/CartView.aspx");
            routes.MapPageRoute("checkout", "checkout", "~/Pages/Checkout.aspx");
            routes.MapPageRoute("admin_retreats", "admin/retreats", "~/Pages/Admin/Retreats.aspx");
            routes.MapPageRoute("admin_addretreat", "admin/addretreat", "~/Pages/Admin/AddRetreat.aspx");
            routes.MapPageRoute("admin_reports", "admin/reports", "~/Pages/Admin/Reports.aspx");

            /*The first argument to the MapPageRoute method specifies a name for the route. We don’t usually 
             * name the main set routes in our applications (which is why they are all null), but it can be useful for 
             * redirecting the user from one part of the application to another. The new route adds support for a /cart URL, 
             * which is handled with the /Pages/CartView.aspx Web Form */
        }
    }
}